export function fadeIn(element,speed){
  var speed = speed || 30 ;
  var num = 0;
  var st = setInterval(function(){
    num++;
    if (!element) clearInterval(st);
    if (element) element.style.opacity = num/10;
    if(num>=10)  {  clearInterval(st);  }
  },speed);
}

export function fadeOut(element,speed){
  var speed = speed || 30 ;
  var num = 10;
  var st = setInterval(function(){
    num--;
    if (!element) clearInterval(st);
    if (element) element.style.opacity = num / 10 ;
    if(num<=0)  {   clearInterval(st);  }
  },speed);
}

var i=500;
function transferImages(element){
  var timer = setInterval(
    function(){
      if(element.style.top=='300px')
        clearInterval(timer);
      i = i - 1;
      element.style.top = i+'px';
    },10);
}
